package com.tvunetworks.center.device.model.json;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
 * @program: tvucc-device
 * @description: Ext、Receiver关联关系
 * @author lebronchen
 * @create: 2019-03-19 14:15
 **/
@JsonIgnoreProperties(ignoreUnknown = true)
public class DeviceSearchStatus implements Serializable{
    private static final long serialVersionUID = -5098467203682596079L;
    private boolean online;
    private boolean live;
    private boolean offline;
    private boolean sort;

    /**
     *
     * @return boolean
     */
    public boolean isNull(){
        return !online && !live && !offline;
    }

    /**
     *
     * @return boolean
     */
    public boolean all(){
        return online && live && offline;
    }

    /**
     *
     * @return String
     */
    public String getStatus(){
        if (this.isNull()) {
            return null;
        }
        StringBuffer status = new StringBuffer();
        if ( online ) {
            status.append("1").append("3");
        }
        if (live) {
            status.append("2");
        }
        if (offline) {
            status.append("0");
        }
        return status.toString();
    }

    /**
     *
     * @return List
     */
    public List<String> getStatusList(){
        List<String> resultList = new ArrayList<String>();
        if (this.isNull()) {
            return null;
        }
        if ( online ) {
            resultList.add("1");
            resultList.add("3");
        }
        if (live) {
            resultList.add("2");
        }
        if (offline) {
            resultList.add("0");
        }
        return resultList;
    }
    
    public boolean getOnline() {
        return online;
    }
    
    public void setOnline(boolean online) {
        this.online = online;
    }
    
    public boolean getLive() {
        return live;
    }
    
    public void setLive(boolean live) {
        this.live = live;
    }
    
    public boolean getOffline() {
        return offline;
    }
    
    public void setOffline(boolean offline) {
        this.offline = offline;
    }
    
    public boolean getSort() {
        return sort;
    }
    
    public void setSort(boolean sort) {
        this.sort = sort;
    }

    @Override
    public String toString() {
        return "DeviceSearchStatus [online=" + online + ", live=" + live + ", offline=" + offline + ", sort=" + sort + "]";
    }
}
